package curiosity.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;

import curiosity.excepcion.DAOExcepcion;
import curiosity.util.ConexionBD;

public class HistPostulaciones {
	
	public Collection<HistPostulaciones> listarPostulante()
			throws DAOExcepcion {
		String query = "select id_postulante, nombre, apellido_paterno, apellido_materno, sexo, ";
		Collection<HistPostulaciones> c = new ArrayList<HistPostulaciones>();
		Connection con = null;
		PreparedStatement stmt = null;
		ResultSet rs = null;
		try {
			con = ConexionBD.obtenerConexion();
			stmt = con.prepareStatement(query);
			rs = stmt.executeQuery();
			while (rs.next()) {
				HistPostulaciones vo = new HistPostulaciones();
				vo.setIdPostulante(rs.getInt("id_postulante"));				
				vo.setNombre(rs.getString("nombre"));
				vo.setApellidoPaterno(rs.getString("apellido_paterno"));
				vo.setApellidoPaterno(rs.getFloat("apellido_materno"));
				vo.setSexo(rs.getInt("sexo"));
				c.add(vo);
			}
		} catch (SQLException e) {
			System.err.println(e.getMessage());
			throw new DAOExcepcion(e.getMessage());
		} finally {
			this.cerrarResultSet(rs);
			this.cerrarStatement(stmt);
			this.cerrarConexion(con);
		}
		return c;
	}

	private void cerrarResultSet(ResultSet rs) {
		// TODO Auto-generated method stub
		
	}

	private void cerrarStatement(PreparedStatement stmt) {
		// TODO Auto-generated method stub
		
	}

	private void cerrarConexion(Connection con) {
		// TODO Auto-generated method stub
		
	}

	private void setApellidoPaterno(String string) {
		// TODO Auto-generated method stub
		
	}

	private void setNombre(String string) {
		// TODO Auto-generated method stub
		
	}

	private void setIdPostulante(int int1) {
		// TODO Auto-generated method stub
		
	}



}
